﻿#pragma warning disable CS0246 // 未能找到类型或命名空间名“MySql”(是否缺少 using 指令或程序集引用?)
using MySql.Data.MySqlClient;
#pragma warning restore CS0246 // 未能找到类型或命名空间名“MySql”(是否缺少 using 指令或程序集引用?)
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace hospital_registration_system.DAL
{
    public class Class1
    {

        public static void Main(string[] args)
        {
            //方法体
            //获得Web.config中的配置信息
            string sqlCconnStr = ConfigurationManager.ConnectionStrings["MySqlStr"].ConnectionString;
            MySqlConnection sqlCon = new MySqlConnection(sqlCconnStr);//连接数据库 


            //打开连接
            sqlCon.Open();

            //SQL语句
            string sql = "delete from manager where id = 3";


            //获得MySsqlCommand
            MySqlCommand cmd = new MySqlCommand(sql, sqlCon);

            //执行SQL
            int updateCount = cmd.ExecuteNonQuery();
            if (updateCount > 0)
            {
                Console.Write("删除成功");
            }
            else
            {
                Console.Write("删除失败");
            }


            cmd = null;
            sqlCon.Close();
            sqlCon = null;

        }

    }
}
